package com.superarai.portal.action.front;

import javax.annotation.Resource;

import org.seasar.struts.annotation.ActionForm;
import org.seasar.struts.annotation.Execute;

import com.superarai.portal.entity.Page;
import com.superarai.portal.form.front.GeneratePageForm;
import com.superarai.portal.service.AbstractPageService;

/**
 * Adminページで作成したページを表示する。
 * @author arai
  */
public class GeneratePageAction {
	
	@ActionForm
	@Resource
	public GeneratePageForm generatePageForm;
	
	@Resource
	protected AbstractPageService pageService;

	@Execute(validator = false, urlPattern = "{path}")
	public String index() {
		generatePageForm.post = getPost(generatePageForm.path);
		return "post.jsp";
	}
	
	private Page getPost(String path) {
		Page post = pageService.findById(path);
		return post;
	}
}
